﻿using System;
using fastCSharp;

namespace diantou.web.topic
{
    /// <summary>
    /// 用户在话题下的回答
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPool = true, IsReferer = false)]
    partial class userAnswer : answer<userAnswer>
    {
        /// <summary>
        /// 用户
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private diantou.dataAccess.user user;
        /// <summary>
        /// 用户在话题下的回答
        /// </summary>
        /// <param name="topicId">话题标识</param>
        /// <param name="userId">用户标识</param>
        /// <param name="page">分页号</param>
        /// <returns>是否成功</returns>
        private bool loadView(int topicId, int userId, int page)
        {
            if (base.load(topicId))
            {
                user = diantou.dataAccess.clientCache.User[userId];
                if (user != null)
                {
                    diantou.dataAccess.answer[] values = diantou.dataAccess.tcpCall.answer.getTopicAnswer(userId, topicId, pageInfo.Size = fastCSharp.config.pub.Default.PageSize, pageInfo.Page = page, currentUserId, out pageInfo.Count);
                    answers = values.getArray(value => new answer.userAnswer { Answer = value, UserId = currentUserId });
                    return true;
                }
                AjaxResponse(webConfig.NotFound404);
            }
            return false;
        }
    }
}